/** 
 * CopyRight (C) 2008-2009 yeyong 
 */  
  
import java.io.UnsupportedEncodingException;  
import java.util.Arrays;   
import javax.servlet.http.HttpServletRequest;  
  
/** 
 * HttpRequestParser 测试程序 
 * @author yy 
 * @date Jun 21, 2009 3:01:01 PM 
 */  
public class HttpRequestParserTest {  
  
  public static void main(String[] args) throws UnsupportedEncodingException {  
    String href = "http://127.0.0.1/xxx/yyy.do?id=A00509062015035396&chinese=%E4%B8%AD%E6%96%87%E5%8F%82%E6%95%B0OK"  
        + "&hobby=A&hobby=B&hobby=C"  
        + "&backUrl=http%3A%2F%2F127.0.0.1%2Fxxx%2Flist.do%3Fsearch_name%3D%25E5%258F%25B6%25E6%25B0%25B8%26page%3D4%26order%3Dusername%2Basc";  
  
    HttpServletRequest request = HttpRequestParser.parse(href);  
    System.out.println(request);  
    System.out.println("full URL:     " + href);  
    System.out.println("request URL:  " + request.getRequestURL());  
    System.out.println("id:           " + request.getParameter("id"));  
    System.out.println("chinese:      " + request.getParameter("chinese"));  
    System.out.println("hobbies:      " + Arrays.toString(request.getParameterValues("hobby")));  
    System.out.println("backUrl:      " + request.getParameter("backUrl"));  
  
    System.out.println();  
    String backUrl = request.getParameter("backUrl");  
    request = HttpRequestParser.parse(backUrl);  
    System.out.println(request);  
    System.out.println("full URL:     " + backUrl);  
    System.out.println("request URL:  " + request.getRequestURL());  
    System.out.println("search name:  " + request.getParameter("search_name"));  
    System.out.println("page:         " + request.getParameter("page"));  
    System.out.println("order:        " + request.getParameter("order"));  
  }  
}  